#{set title: 'Add entity'/}
<html>
<script type="text/javascript" src="@{'/public/javascripts/jquery.validate.js'}"></script>
<script type="text/javascript" src="@{'/public/javascripts/jquery.validate.min.js'}"></script>
<script type="text/javascript" src="@{'/public/javascripts/validation.js'}"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
	<script type="text/javascript">
			function back(orgId, entId) {
				$.ajax({
				   type: "GET",
				   url: "/EEntities/back",
				   data: "orgId="+orgId+"&entId="+entId,
				   success: function(html){
				     $("#orgEntities").replaceWith(html);
				   }
				 });
				 
				 }
</script>

<body>

#{if session.get("username") == null || session.get("username").equalsIgnoreCase("guest")}
<div class="error">
	<p class="error"> You must be connected to edit an organization </p>
</div>
<br></br>

<script type="text/javascript">

      $(document).ready(function() {
	
 		$('#background').hide().addClass( 'positioned' ); 
 			});
</script>

<a href = "@{Secure.login()}" > login now</a>
<a href="@{Users.register()}">New user? register now!</a>
#{/if}





#{ifErrors}
   <h1>All fields are required</h1>
#{/ifErrors}
<br></br>
<div id="background">
<div id="orgEntities">
<form id="addEntityForm" action = "@{EEntities.addEntityToOrg()}" method = "POST">
 
<input type="hidden" name="orgId" value=${orgId}></input>
	
	<div class="formEntry">
		<div class="formLabel">
			<label>Entity name</label>
		</div> 
<input class="inputText" type="text" name="entName"></input>

<div class="clear"></div></div>

	<div class="formEntry">
		<div class="formLabel">
			<label>Entity Description</label>
		</div> 
<input class="inputText" type="text" name="entDescrip"></input>

<div class="clear"></div></div>

	<div class="formEntry">
		<div class="formLabel">
			<label>Entity Lock Status</label>
		</div> 
<input class="inputText" type="radio" name="lock" value = "0"></input><label> unlocked </label>
<input class="inputText" type="radio" name="lock" value = "1"></input><label> locked </label>
<span class="error">#{error 'lock' /}</span>
<div class="clear"></div></div>

	<div class="formEntry">
<input type="submit" value="submit" id="submit"></input>
</div>
</form>

<a class="standardLink" href="javascript:back(${orgId}, -1)"> back </a>
</div>
</div>
</body>
</html>